package com.room.rest;

import com.room.core.annotation.LoginUser;
import com.room.core.dto.UserInfo;
import com.room.core.util.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

@RestController
@RequestMapping("/wx/")
public class FileController {
//    @PostMapping("upload")
//    public R reviewSolicitNew(@LoginUser UserInfo userInfo,
//                              @RequestParam("file") MultipartFile file) throws Exception {
//        File f = new File("/wxImages/" + file.getOriginalFilename());
//        if (!f.getParentFile().exists()){
//            f.getParentFile().mkdir();
//        }
//        BufferedOutputStream out = new BufferedOutputStream(
//                new FileOutputStream(f));
//        out.write(file.getBytes());
//        out.flush();
//        out.close();
//        return R.success();
//    }
}
